/*
 * @Date: 2022-04-05 20:38:36
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-07-15 11:15:18
 * @FilePath: \imitation-microblog-vue\vite.config.ts
 * @Description: vite配置
 */
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
    },
  },
  server: {
    cors: true,
    proxy: {
      "/api": {
        target: "http://sailor.cool/api",
        // process.env.NODE_ENV === "development"
        //   ? "http://localhost:5000/api"
        //   : "http://sailor.cool/api",
        changeOrigin: true,
        ws: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },
});
